package com.ssm.controller;

import com.ssm.bean.Employee;
import com.ssm.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class EmployeeController {

    @Autowired
    EmployeeService employeeService;


    /**
     * 查询所有的员工,并且带上部门信息
     * @param model
     * @return
     */
    @RequestMapping("/emps")
    public String getAllEmp(Model model){
        List<Employee> allEmployee = employeeService.getALLEmployee();
        model.addAttribute("emplist",allEmployee);
        return "list";
    }

}
